const Api = require('../../utils/api.js');
const Rest = require('../../utils/rest');
const WxParse = require('../../components/wxParse/wxParse');

Page({

    data: {

    },

    onLoad: function (options) {
        let that = this;
        Rest.get(Api.JIANGQIE_POST_PAGE, {
            page_id: options.page_id
        }).then(res => {
            wx.setNavigationBarTitle({
                title: res.data.title,
            })

            WxParse.wxParse('article', 'html', res.data.content, that, 5);
        });
    },
    wxParseTagATap: function (e) {
        wx.setClipboardData({
            data: e.currentTarget.dataset.src,
            success(res) {
                wx.getClipboardData({
                    success(res) {
                        wx.showToast({
                            title: '链接复制成功',
                            image: '../../images/link.png',
                        });
                    }
                })
            }
        })
    },
    onShareAppMessage: function () {
        return {
            title: getApp().appName,
            path: 'pages/index/index',
        }
    },

    onShareTimeline: function () {
        return {
            title: getApp().appName,
        }
    },

})